package com.example.reader;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class Main2Activity extends AppCompatActivity {

    private static final String TAG = "Main2Activity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

    }

    public void onclick(View view) throws IOException {
        File file = new File(getExternalCacheDir(), "星辰变1.txt");
        FileOutputStream file1 = new FileOutputStream(file);
        InputStream open = getAssets().open("xcb.txt");
        byte[] bytes = new byte[2048];
        int byteread = 0; // 读取的字节数
        while ((byteread = open.read(bytes)) != -1) {
            file1.write(bytes, 0, byteread);
        }
        file1.close();
        open.close();
        Log.i(TAG, "onclick: ");
    }
}
